
import messageBox from './messageBox.vue';
import { mask } from '../mask/mask.js'
export const lyMessageBox = (params)=>{
  console.log(params,'params')
  let resolve,reject,promise = new Promise((res,rej) => {
    resolve = res;
    reject = rej;
  }) 
  let masker = mask({zIndex:params.zIndex - 1})
  let profie = Vue.extend(messageBox)
  let cpt =  new profie({
    propsData: {
      ...params
    },
    methods:{
      res(arg){
        resolve(arg)
        this.isVisble = false
        masker.isVisbile = false
      },
      rej(arg){
        reject(arg)
        this.isVisble = false
        masker.isVisbile = false
      },
      close(){
        document.body.removeChild(this.$el)
        masker.isVisbile = false
      }
    }
  })
  var el = cpt.$mount().$el
  document.body.appendChild(el)
  return promise
}

